package com.whut.monitor.dao;

import javafx.util.Pair;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONObject;

import java.util.Map;

/**
 * Created by YY on 2017-12-29.
 */
public interface IHBaseRestDao {
    JSONArray getHTableArray();

    JSONObject getHTableRegions(String tableName);

    JSONObject getHTableSchema(String tableName);

    Pair<Boolean, String> createHTableByJson(String tableName, JSONObject strJson);

    Pair<Boolean, String> updateHTableByJson(String tableName, JSONObject strJson);

    Pair<Boolean, String> deleteHTable(String tableName);

    Pair<Boolean, String> findRow(String tableName, String rowkey);

    Pair<Boolean, String> findRowsByprefixFilter(String tableName, String prefixFilter, int maxCount);

    Pair<Boolean, String> findRowsBySuffixFilter(String tableName, String suffixFilter, int maxCount);

    Pair<Boolean, String> findCell(String tableName, String rowkey, String columnFamily, String column);

    Pair<Boolean, String> findMultilVersionCell(String tableName, String rowkey, String columnFamily, String column, int n);

    Pair<Boolean, String> insertCell(String tableName, String rowkey, String columnfamily, String column, String value);

    Pair<Boolean, String> insertRow(String tableName, String rowkey, JSONObject jsonObject);

    Pair<Boolean, String> insertRows(String tableName, JSONObject jsonObject);

    // 兼容原版
    // 单条操作
    Boolean add(String tableName, final String rowKey, final String family, final String qualifier, final String value);
    String find(String tableName, String rowKey, final String family, final String qualifier);

    // 批量操作
    Boolean adds(String tableName, final String rowKey, final String family, final Map<String, String> quaAndValue);
    Boolean adds(String tableName, final Map<String, String> rowkeyAndValue, final String family, final String qualifier);
    Boolean finds(String tableName, String startRow, String stopRow, final Map<String, String> outputRowkeyAndValue);
}
